import 'package:flutter/material.dart';

/// @Author wywinstonwy
/// @Date 2022/6/8 8:32 上午
/// @Description: 

class WyConstraints extends StatefulWidget {
  const WyConstraints({Key? key}) : super(key: key);

  @override
  State<WyConstraints> createState() => _WyConstraintsState();
}

class _WyConstraintsState extends State<WyConstraints> {
  double height = 100;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body:RepaintBoundary(
        child: Container(color: Colors.lightGreen,
          child:Column(children: [
            SizedBox(height: 100,),
            ElevatedButton(onPressed: (){
              if(height == 100.0){
                setState(() {
                  height = 50.0;
                });
              }else{
                setState(() {
                  height = 100.0;
                });
              }
            }, child: Text("改变高度")),
            Container(
              color: Colors.blue,
              child: Container(
                color: Colors.green,
                height: height+100,
                width: height+100,
                child: Container(
                  color: Colors.blue,
                  height: height+200,
                  width: height+200,
                  child: Text(height.toString(),style: TextStyle(backgroundColor: Colors.yellow),),
                ),
              ),
            )
          ],) ,)
      ) ,
    );
  }
}

